//
//  highScore.m
//  sumitup2
//
//  Created by Maelyss FARGES on 03/11/2011.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "highScore.h"


@implementation highScore

@synthesize slave;
@synthesize label_higtscore1; 

@synthesize mydata;


-(NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section {
	return [self.mydata count];
}

-(UITableViewCell *)tableView:(UITableView *)tableView
		cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"bob"];
	if (cell == nil) {
		cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
									 reuseIdentifier:@"bob"];
	}
	NSDictionary *person = [self.mydata objectAtIndex:indexPath.row];
	cell.textLabel.text = [person objectForKey:@"name"];
	cell.detailTextLabel.text = [[person objectForKey:@"score"] stringValue];
	return cell;
}


-(IBAction)somethingtoo
{
	[self dismissModalViewControllerAnimated:YES];
}


/*
- (IBAction) viewHightScore {
	
	NSString y;
	
	NSString *filePath = [[NSBundle mainBundle]
						  pathForResource:@"highscore" ofType:@"plist"];
	NSMutableArray *myhighscore = [[NSMutableArray alloc] initWithContentsOfFile:filePath];
	y = [(NSString *)[myhighscore objectAtIndex:0] stringValue];
	
	//NSString *score1 = (NSString *)y;
	
	label_higtscore1.text = y;
	
	
}


// The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
/*
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization.
    }
    return self;
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	NSString *filePath = [[NSBundle mainBundle]
						  pathForResource:@"highscore" ofType:@"plist"];
	NSArray *filedata = [[NSArray alloc] initWithContentsOfFile:filePath];
	self.mydata = filedata;
	[filedata release];
	
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
